/**
 * 
 */
package kr.pe.johnkim.dayve.provider;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

/**
 * @author johnkim
 *
 */
public class DayveMemberDatabaseHelper extends SQLiteOpenHelper {

	private static final String TAG = DayveMemberDatabaseHelper.class.getSimpleName();
	
	private static final String DATABASE_NAME = "database_member_group.db";
	private static final int DATABASE_VERSION = 10;
	
	public DayveMemberDatabaseHelper(Context context) {
		super(context,  DATABASE_NAME, null, DATABASE_VERSION);	
		Log.e(TAG, "DayveMemberDatabaseHelper");
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		// Member 테이블을 생성 한다.
		db.execSQL(
				" CREATE TABLE if not exists dayve_member" + 
		        " (" +
		        "	  _id					INTEGER PRIMARY KEY AUTOINCREMENT" + 
		        "	, id					TEXT" +
		        "   , password				TEXT" +
		        "   , email				    TEXT" +
		        "   , open_email_yn		    TEXT" +
		        "   , mobile_phone_number   TEXT" +
		        "   , open_mobile_phone_yn  TEXT" +
		        "   , country				TEXT" +
		        "   , open_country_yn		TEXT" +
		        "   , home_page				TEXT" +
		        "   , open_home_page_yn		TEXT" +
		        "   , nick_name				TEXT" +
		        "   , open_nick_name_yn		TEXT" +
		        "   , profile_image_url		TEXT" +
		        "   , open_profile_image_yn TEXT" +
		        "   , facebook_id			TEXT" +
		        "   , facebook_password		TEXT" +
		        "   , open_facebook_yn		TEXT" +
		        "   , twitter_id			TEXT" +
		        "   , twitter_password		TEXT" +
		        "   , open_twitter_yn		TEXT" +
		        "   , birthday 				TEXT" +
		        "   , sex					TEXT" +
		        "   , mileage 				TEXT" +
		        "   , level 				TEXT" +
		        "	, activate_yn			TEXT" +
		        "	, modify_date			TEXT" +
		        "   , register_date 		TEXT" +
		        ");"
		        );
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		db.execSQL("DROP TABLE if exists dayve_member");
		
		// 테이블을 새로 생성 한다.
		onCreate(db);
	}

}
